//封装获取频道列表的逻辑
import { getChannelsAPI } from "@/apis/article"
import { useState,useEffect } from "react"

function useChannel(){
    //1.获取频道列表的逻辑
    //获取频道列表
    getChannelsAPI
  const [channelList, setChannelList] = useState([])
  useEffect(() => {
    getChannelsAPI().then(res => {
      setChannelList(res.data.channels)
    })
  }, [])
    //2.把用到的数据return出去
    return {
        channelList
    }
}

export {useChannel}